> This patch adds..
>
> - fix for Makefile
> - Teach geo.c how to read the <type> and stick it in icon_descr.
> N.B. not sure I did this 100% right
> - Teach gpsdrive.style how to output icon_descr as the "category".
jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \
jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h
internal_styles.c: mkstyle.sh style/README.style style/csv.style style/custom.style style/dna.style style/fugawi.style style/gpsdrive.style style/gpsman.style style/mxf.style style/nima.style style/ozi.style style/s_and_t.style style/xmap.style style/xmapwpt.style
- ./mkstyle.sh > $@ || rm -f $@ ; exit 1
+ ./mkstyle.sh > $@ || (rm -f $@ ; exit 1)
static int in_wpt;
static int in_name;
static int in_link;
+static int in_type;
static int in_cdata;
static char *cdatastr;
+static char *typestr;
static XML_Parser psr;
static waypoint *wpt_tmp;
}
}
+static void
+tag_type(const char **attrv)
+{
+ const char **avp = &attrv[0];
+ while (*avp) {
+ if (strcmp(avp[0], "type") == 0) {
+ wpt_tmp->icon_descr = xstrdup(avp[1]);
+ }
+ avp+=2;
+ }
+}
+
static void
tag_link(const char **attrv)
{
else if (strcmp(el, "coord") == 0) {
tag_coord(attr);
}
+ else if (strcmp(el, "type") == 0) {
+ tag_type(attr);
+ }
}
if (strcmp(el, "waypoint") == 0) {
in_wpt++;
} else if (strcmp(el, "name") == 0) {
in_name++;
+ } else if (strcmp(el, "type") == 0) {
+ tag_type(attr);
+ in_type++;
} else if (strcmp(el, "link") == 0) {
tag_link(attr);
in_link++;
else if (strcmp(el, "name") == 0) {
in_name--;
}
+ else if (strcmp(el, "type") == 0) {
+ wpt_tmp->icon_descr = xstrdup(typestr);
+ memset(typestr,0, MY_CBUF);
+ in_type--;
+ }
else if (strcmp(el, "link") == 0) {
in_link--;
}
memcpy(estr, s, len);
in_cdata++;
}
+ if (in_type) {
+ estr = typestr + strlen(typestr);
+ memcpy(estr, s, len);
+ }
}
void
XML_SetElementHandler(psr, geo_start, geo_end);
cdatastr = xcalloc(MY_CBUF,1);
+ typestr = xcalloc(MY_CBUF,1);
XML_SetCharacterDataHandler(psr, geo_cdata);
}
if ( cdatastr ) {
xfree(cdatastr);
}
+ if ( typestr ) {
+ xfree(typestr);
+ }
fclose(fd);
}
waypointp->position.longitude.degrees);
fprintf(ofd, "\n");
+ if (waypointp->icon_descr) {
+ fprintf(ofd, "<type>%s</type>\n", waypointp->icon_descr);
+ }
if (waypointp->url) {
fprintf(ofd, "<link text =\"Cache Details\">%s</link>\n",
waypointp->url);
"#\n"
"FIELD_DELIMITER SPACE\n"
"RECORD_DELIMITER NEWLINE\n"
-"BADCHARS ,\"\n"
+"BADCHARS ,'\"\n"
-"SHORTLEN 20\n"
-"SHORTWHITE 0\n"
+"SHORTLEN 20\n"
+"SHORTWHITE 0\n"
"#\n"
"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
"IFIELD SHORTNAME, \"\", \"%s\"\n"
"IFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
"IFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
+"IFIELD ICON_DESCR, \"\", \"%s\"\n"
"OFIELD ANYNAME, \"\", \"%s\"\n"
"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD ICON_DESCR, \"\", \"%s\"\n"
;
static char gpsman[] =
"# gpsbabel XCSV style file\n"
<waypoint>
<name id="GCEBB"><![CDATA[Mountain Bike Heaven by susy1313]]></name>
<coord lat="35.972033" lon="-87.134700"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=3771</link>
</waypoint>
<waypoint>
<name id="GC1A37"><![CDATA[The Troll by a182pilot & Family]]></name>
<coord lat="36.090683" lon="-86.679550"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=6711</link>
</waypoint>
<waypoint>
<name id="GC1C2B"><![CDATA[Dive Bomber by JoGPS & family]]></name>
<coord lat="35.996267" lon="-86.620117"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=7211</link>
</waypoint>
<waypoint>
<name id="GC25A9"><![CDATA[FOSTER by JoGPS & Family]]></name>
<coord lat="36.038483" lon="-86.648617"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=9641</link>
</waypoint>
<waypoint>
<name id="GC2723"><![CDATA[Logan Lighthouse by JoGps & Family]]></name>
<coord lat="36.112183" lon="-86.741767"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=10019</link>
</waypoint>
<waypoint>
<name id="GC2B71"><![CDATA[Ganier Cache by Susy1313]]></name>
<coord lat="36.064083" lon="-86.790517"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=11121</link>
</waypoint>
<waypoint>
<name id="GC309F"><![CDATA[Shy's Hill by FireFighterEng33]]></name>
<coord lat="36.087767" lon="-86.809733"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12447</link>
</waypoint>
<waypoint>
<name id="GC317A"><![CDATA[GittyUp by JoGPS / Warner Parks]]></name>
<coord lat="36.057500" lon="-86.892000"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12666</link>
</waypoint>
<waypoint>
<name id="GC317D"><![CDATA[Inlighting by JoGPS / Warner Parks]]></name>
<coord lat="36.082800" lon="-86.867283"/>
+<type>geocache</type>
<link text ="Cache Details">http://www.geocaching.com/seek/cache_details.asp?ID=12669</link>
</waypoint>
</loc>
-GCEBB 35.97203 -87.13470
-GC1A37 36.09068 -86.67955
-GC1C2B 35.99627 -86.62012
-GC25A9 36.03848 -86.64862
-GC2723 36.11218 -86.74177
-GC2B71 36.06408 -86.79052
-GC309F 36.08777 -86.80973
-GC317A 36.05750 -86.89200
-GC317D 36.08280 -86.86728
+GCEBB 35.97203 -87.13470 geocache
+GC1A37 36.09068 -86.67955 geocache
+GC1C2B 35.99627 -86.62012 geocache
+GC25A9 36.03848 -86.64862 geocache
+GC2723 36.11218 -86.74177 geocache
+GC2B71 36.06408 -86.79052 geocache
+GC309F 36.08777 -86.80973 geocache
+GC317A 36.05750 -86.89200 geocache
+GC317D 36.08280 -86.86728 geocache
#
FIELD_DELIMITER SPACE
RECORD_DELIMITER NEWLINE
-BADCHARS ,"
+BADCHARS ,'"
-SHORTLEN 20
-SHORTWHITE 0
+SHORTLEN 20
+SHORTWHITE 0
#
# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
IFIELD SHORTNAME, "", "%s"
IFIELD LAT_DECIMAL, "", "%08.5f"
IFIELD LON_DECIMAL, "", "%08.5f"
+IFIELD ICON_DESCR, "", "%s"
OFIELD ANYNAME, "", "%s"
OFIELD LAT_DECIMAL, "", "%08.5f"
OFIELD LON_DECIMAL, "", "%08.5f"
+OFIELD ICON_DESCR, "", "%s"